package com.platform.modules.acme.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;


/**
 * @Author davenTsang
 * @Description ACME order info
 */
@Getter
@Setter
@TableName("acme_order")
public class AcmeOrderEntity {

    /**
     * primary key
     */
    @TableId
    private String orderId;

    /**
     * order code
     * yyyyMMdd+eight numbers created by redis
     */
    private String orderCode;

    /**
     * member id
     */
    private String memberId;

    /**
     * domain name
     */
    private String domainName;

    /**
     * order location in ca's server
     */
    private String orderLocation;

    /**
     * source of product
     * eg:letsEncript,digicert
     *
     */
    private String prodSource;

    /**
     * order expire time in ACME server
     */
    private LocalDateTime expireTime;

    /**
     * order status on ACME server
     * RFC8555->7.1.3
     *      status:pending|ready(所有验证记录验证通过)|processing(签发过程)|valid(签发完成)|invalid(在签发过程出现错误，则会转到这个状态)
     *
     * pending --------------+
     * |                     |
     * | All authz           |
     * | "valid"             |
     * V                     |
     * ready  ---------------+
     * |                     |
       | Receive             |
     * | finalize            |
     * | request             |
     * V                     |
     * processing ------------+
     * |                     |
     * | Certificate         | Error or
     * | issued              | Authorization failure
     * V                     V
     * valid                invalid
     *
     */
    private String statusOnServer;


    /**
     * auth type
     * HTTP/DNS/TLS
     */
    private String authType;

    /**
     * record create time
     */
    private LocalDateTime createTime;




    private transient  AcmeCertificateEntity acmeCertificateEntity;


}
